﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/MasterPage.master" AutoEventWireup="true"
    CodeFile="GuestBook.aspx.cs" Inherits="GuestBook" %>
<%@ MasterType VirtualPath="~/MasterPage/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        #outtable
        {
            width: 100%;
            border-collapse: collapse;
            empty-cells: show;
        }
        #outtable #outleft
        {
            width: 250px;
            vertical-align: top;
            padding-right: 5px;
        }
        #outtable #outleft #pb_top
        {
            background: url(<%=ResolveUrl("~/images/newsbunner.gif")%>) no-repeat;
            width: 100%;
            height: 28px;
            margin-top: 0px;
            margin-bottom: 0px;
        }
        #outtable #outleft #pb_top #pb_top_title
        {
            top: 5px;
            margin-left: 10px;
            font-size: 13px;
            height: 20px;
            position: relative;
            display: block;
        }
        #outtable #outleft #pb_cen
        {
            padding: 10px;
            width: 228px;
            border: 1px solid #bdbdbd;
            border-bottom: 0px;
            min-height: 200px;
            background-color: White;
            margin-bottom: 0px;
            margin-top: 0px;
        }
        #outtable #outleft #pb_cen input
        {
            width: 215px;
        }
        #outtable #outleft #pb_cen textarea
        {
            width: 215px;
            height: 250px;
        }
        #outtable #outleft #pb_bom
        {
            background: url(<%=ResolveUrl("~/images/tuijiandown.gif")%>) no-repeat;
            width: 100%;
            height: 28px;
        }
        #outtable #outright
        {
            border: 1px #d6d6d6 solid;
            vertical-align: top;
            background: url(<%=ResolveUrl("~/images/con_body-x.png")%>) repeat-y;
        }
        #list_body
        {
            width: 97%;
            height: auto;
            margin-top: 5px;
            background-color: White;
            margin-bottom: 10px;
            padding-bottom: 15px;
            margin-left: 10px;
            background-color: #eeeee2;
        }
        #list_body table
        {
            width: 100%;
            margin-bottom: 20px;
            border-collapse: collapse;
            empty-cells: show;
            background-color: White;
        }
        #list_body table .td_left
        {
            width: 70px;
        }
        #list_body table td
        {
            height: 25px;
            border: 1px solid #dddddd;
        }
    </style>
    <script type="text/javascript">
        var check_Email = function () {
            if ($.trim(jQuery("[id$=Email_tb]").val()).length < 1) {
                alert("请输入Email");
                return false;
            }
            var pattern = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;
            if (!pattern.test(jQuery("[id$=Email_tb]").val())) {
                alert("邮箱格式不正确");
                return false;
            }
            return true;
        }
        var check_Name = function () {
            if ($.trim(jQuery("[id$=Name_tb]").val()).length < 1) {
                alert("请输入姓名");
                return false;
            }
            if ($.trim(jQuery("[id$=Name_tb]").val()).length > 20) {
                alert("姓名在20个字符以内");
                return false;
            }
            return true;
        }
        var check_Content = function () {
            if ($.trim(jQuery("[id$=Content_tb]").val()).length < 1) {
                alert("请输入留言内容");
                return false;
            }
            if ($.trim(jQuery("[id$=Content_tb]").val()).length > 1000) {
                alert("留言内容在1000个字符以内");
                return false;
            }
            return true;
        }
        var check_submit = function () {
            var boolsubmit;
            boolsubmit = check_Name() && check_Email() && check_Content();
            return boolsubmit;
        }


        jQuery(document).ready(function () {
            //处理左边文章发布的随滚动条滚动
            var navH = $("#public_body").offset().top;
            jQuery(window).scroll(function () {
                var scroH = $(this).scrollTop();
                if (scroH >= navH) {
                    jQuery("#public_body").css({ "position": "fixed", "top": 0 });
                } else if (scroH < navH) {
                    jQuery("#public_body").css({ "position": "static" });
                }
            });
        });
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="outtable">
        <tr>
            <td id="outleft">
                <div id="public_body">
                    <div id="pb_top">
                        <div id="pb_top_title">
                            发布新留言</div>
                    </div>
                    <div id="pb_cen">
                        姓名(*)：
                        <br />
                        <asp:TextBox ID="Name_tb" runat="server" TextMode="SingleLine"></asp:TextBox>
                        <br />
                        <br />
                        邮箱(*)(不公开)：
                        <br />
                        <asp:TextBox ID="Email_tb" runat="server" TextMode="SingleLine"></asp:TextBox>
                        <br />
                        <br />
                        留言内容(*)(1000个字符以内)：
                        <br />
                        <asp:TextBox ID="Content_tb" runat="server" TextMode="MultiLine"></asp:TextBox>
                        <br />
                        <br />
                        <asp:Button ID="Submit_btn" runat="server" Text="提交留言" OnClientClick="return check_submit();" onclick="Submit_btn_Click" />
                    </div>
                    <div id="pb_bom">
                    </div>
                </div>
            </td>
            <td id="outright">
                <div style="height: 20px; width: 99%; margin-left: 2px; border: 1px solid #d6d6d6;
                    margin-top: 5px; background-color: #b7b8b9;">
                    <span style="margin-left: 10px; display: block; margin-top: 2px;">现在的位置:首页→留言板 </span>
                </div>
                <div id="list_body">
                    <asp:Repeater ID="guest_list" runat="server">
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td class="td_left">
                                        姓　　名：
                                    </td>
                                    <td>
                                        <%# Eval("Name")%><a name='<%# Eval("id")%>'></a>
                                        <span style="display: inline-block; text-align: right; float: right;">
                                            <%# Eval("theDate")%></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">
                                        留言内容：
                                    </td>
                                    <td style=" line-height:150%; padding-top:5px; padding-bottom:5px;">
                                        <%# Eval("Content")%>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td_left">
                                        回　　复：
                                    </td>
                                    <td>
                                        <%# Eval("Reply")%>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:Repeater>
                    <span style="position: relative; width: 510px; left: 50%; margin-left: -255px; margin-top: 25px;
                        display: block;">
                        <asp:LinkButton ID="toone" runat="server" OnClick="toone_Click">[首页]</asp:LinkButton>
                        <asp:LinkButton ID="toup" runat="server" OnClick="toup_Click">[上一页]</asp:LinkButton>&nbsp;
                        <asp:LinkButton ID="tonext" runat="server" OnClick="tonext_Click">[下一页]</asp:LinkButton>
                        <asp:LinkButton ID="tolast" runat="server" OnClick="tolast_Click">[尾页]</asp:LinkButton>&nbsp;
                        [跳转到第
                        <asp:DropDownList ID="jumppage" runat="server" OnSelectedIndexChanged="jumppage_SelectedIndexChanged"
                            AutoPostBack="true" Style="height: 20px; margin-left: 3px; margin-bottom: -3px;">
                        </asp:DropDownList>
                        页]&nbsp;&nbsp; [页次:<asp:Label ID="curpage" runat="server" ForeColor="red"></asp:Label>
                        /
                        <asp:Label ID="sumpage" runat="server" Text="Label"></asp:Label>页] [共<asp:Label ID="pagesum"
                            runat="server" Text="Label" ForeColor="red"></asp:Label>项
                        <asp:Label ID="tpagesizes" runat="server" Text="Label" ForeColor="red"></asp:Label>项/页]
                    </span>
                </div>
            </td>
        </tr>
    </table>
</asp:Content>